/**
 * 
 * @param {number[][]} arr 
 * @returns {number[]}
 */
function main(arr, target) {
    const ans = [];
    const newArr = arr.flat(2)
    console.log(arr, newArr)
    let l = 0, r = newArr.length;

    while (l <= r) {
        const mid = Math.floor((l + r) / 2);
        const num = newArr[mid];
        if (target === num) {
            ans.push(Math.floor(mid / arr.length), mid % arr.length);
            break;
        } else if (target > num) {
            l = mid + 1;
        } else {
            r = mid - 1;
        }
    }

    return ans
}

module.exports = main;